package core.basic;



public class Movement {
	public boolean pass = true;
	public Piece p;
	public boolean side;
	
	@Override
	public int hashCode() {
		int min = p.getLeft() < p.getRight() ? p.getLeft() : p.getRight();
		int max = p.getLeft() > p.getRight() ? p.getLeft() : p.getRight();
		max*=10;
		int pass = this.pass ? 100 : 0;
		int side = this.side ? 1000 : 0;
		return min + max + pass + side;
	}
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Movement)
			return ((Movement)obj).hashCode() == this.hashCode();
		return super.equals(obj);
	}
}
